package cb.wzby;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ListDemo6 {
    public static void main(String[] args) {
        // 数组转换集合list
        Integer [] a = {1,2,3};
        System.out.println(new ArrayList<Integer>(Arrays.asList(a)));



         int [] b = {4,5,6};
        List<Integer> c = new ArrayList<>(b.length);
        for ( int t :b){
            c.add(t);
        }
        System.out.println(c);
        //定义list
        List<Integer> l = Arrays.asList(1,2,3);
        System.out.println(l);
        System.out.println("==".repeat(10));
        //list转换数组
        System.out.println(Arrays.toString(c.toArray()));
    }
}
